const { config, gulp } = require("./gulp.config.js");
const { compileSass } = require('./compileSass.js')
const { fileinclude } = require('./fileinclude.js')
const { uglifyJs } = require('./uglifyJs.js')
const { build } = require('./build.js')

const dev = async () => {
	console.log("监听任务开始");
	gulp.watch(config.srcPath + 'sass/**/*.{scss,css}', {
		ignoreInitial: false // 初始化立即开始编译
	}, compileSass); // 编译sass文件,并压缩合并
	gulp.watch([config.srcPath + 'temp/*.html', config.srcPath + '_include/**/*.html'], {
		ignoreInitial: false // 初始化立即开始编译
	}, fileinclude) // 监听模板文件
	gulp.watch(config.srcPath+'js/**/*.js', {
		ignoreInitial: false // 初始化立即开始编译
	}, uglifyJs);
}

module.exports = {
	compileSass,
	fileinclude,
	uglifyJs,
	dev,
	build
}

